package com.yaoxuguang.concurrence.thread_communication;

/**
 * @author yaoxuguang
 * @Title: yao-interview
 * @Package com.yaoxuguang.concurrence.thread_communication
 * @Description: TODO
 * @date 2018年12月20日11:20
 */
public class ThreadB extends Thread {
    private MyList list;

    public ThreadB(MyList list) {
        this.list = list;
    }

    @Override
    public void run() {
        try {
            while (true) {
                if(5 == list.getSize()){
                    System.out.println("==5,线程b退出");
                    throw new InterruptedException();
                }
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
